<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

/**
 * User home page
 */
Route::get('/', [
	'uses'=>'User\MainPageController@index',
	'middleware' =>'auth',
	]);

// 需要登录验证才能操作的接口
Route::group(array('before' => 'auth'), function()
{
    Route::get('auth/logout', ['as' => 'logout', 'uses' => 'Auth\AuthController@getLogout']);
});
	
/**
 * Patient related pates;
 */
Route::group(['prefix'=>'patient'],function(){	
	Route::get('list','User\PatientController@index');
	Route::get('patient/{patient_id}/case/{case_id}/print','User\PatientCaseController@printPreview');	
	Route::resource('info','User\PatientController');
	Route::resource('patient.case','User\PatientCaseController');
	Route::resource('patient.case.picture','User\PictureController');
});

Route::group(['prefix' => 'case'],function(){	
	Route::resource('info','User\CaseController');
});

/*
 *User related pages.	
 */
Route::group(['prefix' => 'user'],function(){
	Route::get('/','User\UserController@index');
	Route::post('avatar/{id}','User\UserController@updateAvatar');//
	Route::resource('info','User\UserController');
});

/**
 * Search Controller
 */
 Route::get('search','User\SearchController@show');

/**
 * Upload Controller
 */
Route::group(['prefix'=>'api'],function(){	
	Route::post('upload','Api\UploadController@store');
	Route::get('upload','Api\UploadController@store');	
	Route::get('upload/requestPic','Api\UploadController@show');
	Route::post('upload/updatePic','Api\UploadController@edit');	
	Route::post('upload/loadPic','Api\UploadController@load');
});


Route::get('test',function(){
	return view('user.case.test');
}); 

/**
 *Regist controller route here
 * 
 */ 
Route::controllers([
	'auth' => 'Auth\AuthController',
	'password' => 'Auth\PasswordController',
]);


